package com.jpa.sepcification.demo.test.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.time.Instant;

/**
 * User
 *
 * @author zcj
 * @date 2020-12-28 13:34:38
 */
@Entity
@Table(name = "user")
public class UserDO {

	@Id
	private String id;

	/**
	 * 用户名
	 */
	@Column(name = "user_name")
	private String userName;

	/**
	 * 密码
	 */
	@Column(name = "password")
	private String password;

	/**
	 * 真实姓名
	 */
	@Column(name = "name")
	private String name;

	/**
	 * 头像（网址）
	 */
	@Column(name = "avatar")
	private String avatar;

	/**
	 * 邮箱
	 */
	@Column(name = "email")
	private String email;

	/**
	 * 手机号
	 */
	@Column(name = "phone")
	private String phone;

	/**
	 * 创建人
	 */
	@CreatedBy
	@Column(name = "CREATED_BY", columnDefinition = "varchar(32) DEFAULT NULL COMMENT '创建人'")
	private String createdBy;

	/**
	 * 创建时间
	 */
	@CreatedDate
	@Column(name = "CREATED_TS", nullable = false)
	private Instant createdDate;

	/**
	 * 最后更新人
	 */
	@LastModifiedBy
	@Column(name = "UPDATED_BY", columnDefinition = "varchar(32) DEFAULT NULL COMMENT '更改人'")
	private String lastModifiedBy;

	/**
	 * 最后更新时间
	 */
	@LastModifiedDate
	@Column(name = "UPDATED_TS")
	@JsonIgnore
	private Instant lastModifiedDate;

	/**
	 * 版本
	 */
	@Version
	@Column(name = "VERSION")
	private Integer version;


	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAvatar() {
		return this.avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public Instant getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Instant createdDate) {
		this.createdDate = createdDate;
	}

	public String getLastModifiedBy() {
		return lastModifiedBy;
	}

	public void setLastModifiedBy(String lastModifiedBy) {
		this.lastModifiedBy = lastModifiedBy;
	}

	public Instant getLastModifiedDate() {
		return lastModifiedDate;
	}

	public void setLastModifiedDate(Instant lastModifiedDate) {
		this.lastModifiedDate = lastModifiedDate;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	@Override
	public String toString() {
		return "UserDO{" +
				", userName='" + userName + '\'' +
				", password='" + password + '\'' +
				", name='" + name + '\'' +
				", avatar='" + avatar + '\'' +
				", email='" + email + '\'' +
				", phone='" + phone + '\'' +
				", id='" + id + '\'' +
				'}';
	}
}
